package org.halk.bio.socket;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;

/**
 * 套接字客户端
 *
 * @Author zhuhao
 * @Date 2022/5/25 9:47
 * @desc
 */
public class SocketClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 8181);
        System.out.println("client 上线。。。");
        BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        bufferedWriter.write("nihao");
        bufferedWriter.flush();
        System.out.println("client 发送 nihao");

        socket.shutdownOutput();
    }
}
